package com.pn.warehouse.service.impl;

import com.pn.warehouse.entity.Brand;
import com.pn.warehouse.mapper.BrandMapper;
import com.pn.warehouse.service.BrandService;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@CacheConfig(cacheNames = "com.pn.warehouse.service.impl.BrandServiceImpl")
@Service
public class BrandServiceImpl implements BrandService {

    @Resource
    private BrandMapper brandMapper;

    //查询所有的品牌
    @Cacheable(key = "'all:brand'")
    @Override
    public List<Brand> findAllBrand() {
        List<Brand> brandList = brandMapper.findAllBrand();
        return brandList;
    }

}
